package com.jg.service.impl;

import com.jg.dto.BookParam;
import com.jg.entity.Book;
import com.jg.mapper.BookMapper;
import com.jg.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 86130
 * @version 1.0
 * @description: TODO
 * @date 2025/6/16 下午2:56
 */
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    BookMapper bookMapper;

    @Override
    public List<Book> list(BookParam bookParam) {
        return bookMapper.getList(bookParam);
    }

    @Override
    public String add(Book book) {
        return bookMapper.add(book) > 0 ? "success" : "fail";
    }

    @Override
    public String delete(Integer bookID) {
        return bookMapper.delete(bookID) > 0 ? "success" : "fail";
    }

    @Override
    public String update(Book book) {
        return bookMapper.update(book) > 0 ? "success" : "fail";
    }

    @Override
    public Book detail(Integer bookID) {
        return bookMapper.getBookById(bookID);
    }
}
